// 心理临床后台管理api
import { requestHasToken as request } from '../util/server'

//#region 医院管理
// 添加医院
export function addHospital (hospital) {
  return request({
    url: '/TbHospital/addTbHospital',
    method: 'post',
    data: hospital
  })
};
// 修改医院
export function updateHospital (hospital) {
  return request({
    url: '/TbHospital/updateTbHospital',
    method: 'put',
    data: hospital
  })
};
// 删除医院
export function deleteHospital (hospitalId) {
  return request({
    url: '/TbHospital/deleteTbHospital/' + hospitalId,
    method: 'delete'
  })
};
// 分页查询医院
export function getHospitalByPage (query) {
  return request({
    // url: '/TbHospital/queryTbHospitalPage',
    url: '/enterprise/queryEndElementPage',
    method: 'post',
    data: query
  })
};
// 不分页查询医院
export function getAllHospital () {
  return request({
    url: '/TbHospital/queryTbHospitalList',
    method: 'get'
  })
};
// 生成二维码
export function genHospitalQRCode (qrInfo) {
  return request({
    url: '/TbHospital/updateHospitalUrl',
    method: 'put',
    data: qrInfo
  })
}
//#endregion
//#region 医生标签管理
// 添加医生标签
export function addDoctorLabel (labelName) {
  return request({
    url: '/TbDoctorLabel/addTbDoctorLabel',
    method: 'post',
    data: {
      doctorLabelName: labelName
    }
  })
};
// 修改医生标签
export function updateDoctorLabel (label) {
  return request({
    url: '/TbDoctorLabel/updateTbDoctorLabel',
    method: 'put',
    data: label
  })
};
// 删除医生标签
export function deleteDoctorLabel (labelId) {
  return request({
    url: '/TbDoctorLabel/deleteTbDoctorLabel/' + labelId,
    method: 'delete'
  })
};
// 分页查询医生标签
export function getDoctorLabelByPage (query) {
  return request({
    url: '/TbDoctorLabel/queryTbDoctorLabelPage',
    method: 'post',
    data: query
  })
};
// 查询所有医生标签
export function getAllDoctorLabel () {
  return request({
    url: '/TbDoctorLabel/queryTbDoctorLabelList',
    method: 'get'
  })
}
//#endregion
//#region 医生管理
// 添加医生
export function addDoctor (doctor) {
  return request({
    url: '/TbPsychologicalClinicianLogin/add',
    method: 'post',
    data: doctor
  })
};
// 修改医生
export function updateDoctor (doctor) {
  return request({
    url: '/TbPsychologicalClinicianLogin/updateTbPsychologicalClinicianLogin',
    method: 'put',
    data: doctor
  })
};
// 设置医生状态
export function setDoctorStatus (doctorId, status) {
  return request({
    url: '/TbPsychologicalClinicianLogin/updatepsychologicalClinicianEnable',
    method: 'put',
    data: {
      psychologicalClinicianId: doctorId,
      psychologicalClinicianEnable: status
    }
  })
};
// 重置医生登录密码
export function resetDoctorPassword (doctorId) {
  return request({
    url: '/TbPsychologicalClinicianLogin/resetpsychologicalClinicianPassword',
    method: 'put',
    data: {
      psychologicalClinicianId: doctorId
    }
  })
};
// 分页查询医生账号
export function getDoctorByPage (query) {
  return request({
    url: '/TbPsychologicalClinicianLogin/TbPsychologicalClinicianLoginPage',
    method: 'post',
    data: query
  })
};
// 医生添加基本信息
export function finishDoctorInformation (info) {
  return request({
    url: '/TbPsychologicalClinician/createTbPsychologicalClinician',
    method: 'post',
    data: info
  })
};
// 查询医生基本信息
export function getDoctorInformation (doctorId) {
  return request({
    url: '/TbPsychologicalClinician/queryClinicianId/' + doctorId,
    method: 'get'
  })
};
// 修改医生信息审核状态
export function setDoctorInformationStatus (doctorId, status) {
  return request({
    url: '/TbPsychologicalClinicianLogin/updateStatus',
    method: 'put',
    data: {
      psychologicalClinicianId: doctorId,
      clinicianStatus: status
    }
  })
};
// 通知医生审核结果
export function sendSubscription (data) {
  return request({
    url: '/wxSubscribe/send',
    method: 'post',
    data: data
  })
};
//#endregion
//#region 地区管理
// 添加地区
export function addArea (area) {
  return request({
    url: '/tbArea/insert',
    method: 'post',
    data: area
  })
};
// 修改地区
export function updateArea (area) {
  return request({
    url: '/tbArea/update',
    method: 'put',
    data: area
  })
};
// 分页查询地区
export function getAreaByPage (query) {
  return request({
    url: '/tbArea/tbAreaPage',
    method: 'post',
    data: query
  })
};
// 删除地区
export function deleteAreaById (areaId) {
  return request({
    url: '/tbArea/deleteById/' + areaId,
    method: 'delete'
  })
};
// 根据地id查询所有地区
export function getAllArea (id) {
  return request({
    url: `/tbArea/queryByIdAll/${id}`,
    method: 'get',
  })
};
// 查询所有地区
export function getAllAreaNoPage () {
  return request({
    url: '/tbArea/queryAll',
    method: 'get'
  })
}
//#endregion
//#region 科室管理
// 添加科室
export function addDepartment (dep) {
  return request({
    url: '/tbDepartment/addTbDepartment',
    method: 'post',
    data: dep
  })
};
// 修改科室
export function updateDepartment (dep) {
  return request({
    url: '/tbDepartment/updateTbDepartment',
    method: 'put',
    data: dep
  })
};
// 删除科室
export function deleteDepartment (depId) {
  return request({
    url: `/tbDepartment/deleteById/${depId}`,
    method: 'delete'
  })
};
// 分页查询科室
export function getDepartmentByPage (query) {
  return request({
    url: '/tbDepartment/tbDepartmentPage',
    method: 'post',
    data: query
  })
};
// 查询所有科室
export function getAllDepartment () {
  return request({
    url: '/tbDepartment/queryAll',
    method: 'get'
  })
}
//#endregion
//#region 职称管理
// 添加职称
export function addCareerTitle (career) {
  return request({
    url: '/tbDoctorTitle/addTbDoctorTitle',
    method: 'post',
    data: career
  })
};
// 修改职称
export function updateCareerTitle (career) {
  return request({
    url: '/tbDoctorTitle/updateTbDoctorTitle',
    method: 'put',
    data: career
  })
};
// 删除职称
export function deleteCareerTitle (careerId) {
  return request({
    url: `/tbDoctorTitle/deleteById/${careerId}`,
    method: 'delete'
  })
};
// 分页查询职称
export function getCareerTitleByPage (query) {
  return request({
    url: '/tbDoctorTitle/tbDoctorTitlePage',
    method: 'post',
    data: query
  })
};
// 查询所有职称
export function getAllCareer () {
  return request({
    url: '/tbDoctorTitle/queryAll',
    method: 'get'
  })
}
//#endregion
//#region 知心意用户管理
// 分页查询用户列表
export function getUserByPage (query) {
  return request({
    url: '/tbWechatUser/queryWechatUser',
    method: 'post',
    data: query
  })
};
// 根据openid查询成员列表
export function getMemberByOpenId (openId) {
  return request({
    url: '/TbPsychologicalClinicalUser/queryMember/' + openId,
    method: 'get'
  })
};
// 查询成员量表购买记录
export function getMemberOrder (query) {
  return request({
    url: '/TbPsychologicalClinicalUser/purchaseHistory',
    method: 'post',
    data: query
  })
}

//#endregion
//#region 学校管理
// 获取学校列表
export function getSchoolList (query) {
  return request({
    url: '/tbSchool/pageTbSchoolPage',
    method: 'post',
    data: query
  })
};
// 添加学校
export function addSchool (school) {
  return request({
    url: '/tbSchool/addTbSchool',
    method: 'post',
    data: school
  })
};
// 修改学校
export function updateSchool (school) {
  return request({
    url: '/tbSchool/updateTbSchool',
    method: 'put',
    data: school
  })
};
// 删除学校
export function deleteSchoolById (schoolId) {
  return request({
    url: `/tbSchool/deleteTbSchool/${schoolId}`,
    method: 'delete'
  })
};
// 获取学校省份统计数据
export function getSchoolChartData () {
  return request({
    url: '/tbSchool/queryNumber',
    method: 'get'
  })
}
//#endregion
